package test;

/**
 * Shell sector data change from 1.0.5 to 1.0.6.
 */
public class ShellSector {

    final static double Length = 1000, Center = (Length/2);

    final static double Uniform(double x){
        if (x < Center)
            return (x/Center);
        else {
            return ((Center-(x-Center))/Center);
        }
    }
    final static int Top = 20;

    final static float ShellLow = 2.0f;
    final static float ShellHigh = 4.0f;

    final static float Shells[];
    static {
        final float shells[] = new float[Top];

        final float ds = (ShellHigh-ShellLow)/(Top-1.0f);

        float sector = ShellLow;

        for (int cc = 0; cc < Top; cc++, sector += ds){

            shells[cc] = sector;
        }
        Shells = shells;
    }
    final static float Model105(float station){
        int fit = (int)(Uniform(station)*(Top-1));
        return Shells[fit];
    }
    final static float Model106(float station){
        final double fit = (Uniform(station)*(Top-1));

        final double ds = (ShellHigh-ShellLow)/(Top-1.0f);

        return ShellLow+(float)(fit*ds);
    }

    public static void main(String[] argv){
        final float df = (float)(Length/Top);
        float ef = df;
        for (int cc = 0; cc < Top; cc++){

            System.out.printf("[S % 5.0f] [U % 1.2f] (1 % 1.4f) (2 % 1.4f)%n",ef,Uniform(ef),Model105(ef),Model106(ef));
            ef += df;
        }
    }
}
